//
//  ViewController.m
//  Login
//
//  Created by Justsoso on 16/2/24.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import "ViewController.h"
#import "InfoViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    InfoViewController *info = segue.destinationViewController;
    
    if ([self.nameTextField.text isEqualToString:@"admin"] && [self.passwordTextField.text isEqualToString:@"123456"])
    {
        info.info = [NSString stringWithFormat:@"用户名是:%@ 密码是:%@ 登录成功",self.nameTextField.text,self.passwordTextField.text];
    }
    else
    {
        info.info = [NSString stringWithFormat:@"用户名是:%@ 密码是:%@ 登录失败",self.nameTextField.text,self.passwordTextField.text];
    }
    
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [self.view endEditing:YES];
}

@end
